package com.sky.controller.user;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.sky.dto.BorrowingHistoryQueryDTO;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.UserBorrowhistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/borrowing-history")
@Api(tags = "用户借阅历史相关接口")
@Slf4j
public class UserBorrowHistoryController {

    @Autowired
    private UserBorrowhistoryService userBorrowhistoryService;

    /**
     * 获取用户借阅历史列表
     * @param queryDTO 查询条件
     * @return 分页结果
     */
    @SaCheckLogin
    @PostMapping
    @ApiOperation("获取借阅历史列表")
    public Result<PageResult> getBorrowingHistory(@RequestBody BorrowingHistoryQueryDTO queryDTO) {
        log.info("获取用户借阅历史列表：{}", queryDTO);
        PageResult pageResult = userBorrowhistoryService.getBorrowingHistory(queryDTO);
        return Result.success(pageResult);
    }
} 